/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.testis.nicmodule.services;

import org.testis.data.TestStepException;
import org.testis.data.TestStepResultType;
import org.testis.services.AtofModuleAction;
import org.testis.services.AtofModuleActionFactory;
import org.testis.testdriver.AtofEnumaration.AtofNetworkModuleAction;


/**
 *
 * @author root
 */
public class NicModuleActionFactory extends AtofModuleActionFactory {

    @Override
    public AtofModuleAction getActionObject(String actionType) {
        AtofNetworkModuleAction action;
        try {
            action = AtofNetworkModuleAction.valueOf(actionType);
        } catch (IllegalArgumentException ex) {

            throw new TestStepException(TestStepResultType.MISTAKE,
                                        "Action type given " + actionType +
                                        " not found for NicModuleActionFactory Application ..." +
                                        ex.getMessage());
        }
        AtofModuleAction actionObj = null;
        if (action ==
            AtofNetworkModuleAction.VerifyInterfaceConfiguration) {
            actionObj = new NicModuleVerifyInterfaceConfigurationAction();
        }
        else if (action ==
            AtofNetworkModuleAction.SetAndVerifyInterfaceConfiguration) {
            actionObj = new NicModuleSetAndVerifyInterfaceConfigurationAction();
        }
        else if (action == AtofNetworkModuleAction.AdjustInterface) {
            actionObj = new NicModuleAdjustInterfaceAction();
        }
        else if (action == AtofNetworkModuleAction.RenewDhcpConfiguration) {
            actionObj = new NicModuleRenewDhcpConfigurationAction();
        }
        else {
            throw new TestStepException(TestStepResultType.ERROR,
                                        "Action type given " + actionType +
                                        " not found for NicModuleActionFactory ..." +
                                        "No given method found");
        }
        return actionObj;

    }
}
